<!DOCTYPE html>
<html>
<head>
    <title>启动中...</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            background: linear-gradient(135deg, #2b5876, #4e4376, #2b32b2);
            background-size: 400% 400%;
            animation: gradientBG 15s ease infinite;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100vh;
            font-family: "Microsoft YaHei", Arial, sans-serif;
            color: white;
            overflow: hidden;
        }

        @keyframes gradientBG {
            0% { background-position: 0% 50%; }
            50% { background-position: 100% 50%; }
            100% { background-position: 0% 50%; }
        }

        .loading-container {
            background: rgba(255, 255, 255, 0.08);
            backdrop-filter: blur(20px);
            border-radius: 24px;
            padding: 40px 60px;
            box-shadow: 
                0 10px 30px rgba(0, 0, 0, 0.2),
                inset 0 1px 2px rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.1);
            text-align: center;
            position: relative;
            overflow: hidden;
            transition: all 0.3s ease;
        }

        .loading-container::before {
            content: '';
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: radial-gradient(
                circle,
                rgba(255, 255, 255, 0.08) 0%,
                transparent 70%
            );
            animation: shine 6s linear infinite;
            transform-origin: center;
        }

        .loading-container:hover {
            transform: translateY(-2px);
            box-shadow: 
                0 15px 40px rgba(0, 0, 0, 0.25),
                inset 0 1px 2px rgba(255, 255, 255, 0.1);
        }

        @keyframes shine {
            from { transform: rotate(0deg); }
            to { transform: rotate(360deg); }
        }

        h2 {
            margin: 0 0 20px 0;
            font-size: 24px;
            font-weight: 500;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
        }

        .spinner {
            width: 60px;
            height: 60px;
            border: 3px solid rgba(255,255,255,0.3);
            border-radius: 50%;
            border-top-color: #fff;
            animation: spin 1s ease-in-out infinite;
            margin: 20px auto;
        }

        @keyframes spin {
            to { transform: rotate(360deg); }
        }

        .status {
            margin-top: 20px;
            font-size: 16px;
            color: rgba(255,255,255,0.9);
            text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
        }

        .error {
            color: #ff6b6b;
            margin-top: 20px;
            font-weight: 500;
            text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
            display: none;
        }

        .buttons {
            margin-top: 25px;
            display: none;
            gap: 15px;
        }

        button {
            padding: 10px 25px;
            border: none;
            border-radius: 25px;
            cursor: pointer;
            font-size: 15px;
            font-weight: 500;
            transition: all 0.3s ease;
            text-shadow: 1px 1px 1px rgba(0,0,0,0.1);
            position: relative;
            overflow: hidden;
        }

        button::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(rgba(255,255,255,0.2), transparent);
            pointer-events: none;
        }

        .retry {
            background: linear-gradient(45deg, #4facfe 0%, #00f2fe 100%);
            color: white;
            box-shadow: 0 4px 15px rgba(79,172,254,0.4);
        }

        .retry:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(79,172,254,0.6);
        }

        .close {
            background: linear-gradient(45deg, #ff512f 0%, #dd2476 100%);
            color: white;
            box-shadow: 0 4px 15px rgba(255,81,47,0.4);
        }

        .close:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(255,81,47,0.6);
        }

        .app-version {
            position: absolute;
            bottom: 20px;
            color: rgba(255,255,255,0.6);
            font-size: 12px;
            text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
        }
    </style>
</head>
<body>
    <div class="loading-container">
        <h2>TimerPOS</h2>
        <div class="spinner"></div>
        <div class="status">正在启动服务...</div>
        <div class="error">启动失败，请检查服务状态</div>
        <div class="buttons">
            <button class="retry">重新启动</button>
            <button class="close">关闭程序</button>
        </div>
    </div>
    <div class="app-version">Version 2025.02.18</div>


    <script>
        const { ipcRenderer } = require('electron');
        
        const status = document.querySelector('.status');
        const error = document.querySelector('.error');
        const buttons = document.querySelector('.buttons');
        const spinner = document.querySelector('.spinner');
        
        ipcRenderer.on('startup-status', (event, message) => {
            status.textContent = message;
            status.style.display = 'block';
        });
        
        ipcRenderer.on('startup-failed', () => {
            error.style.display = 'block';
            buttons.style.display = 'flex';
            status.style.display = 'none';
            spinner.style.display = 'none';
        });
        
        document.querySelector('.retry').addEventListener('click', () => {
            error.style.display = 'none';
            buttons.style.display = 'none';
            status.style.display = 'block';
            spinner.style.display = 'block';
            status.textContent = '正在重新启动服务...';
            ipcRenderer.send('retry-startup');
        });
        
        document.querySelector('.close').addEventListener('click', () => {
            ipcRenderer.send('close-app');
        });
    </script>
</body>
</html> 